<!-- TODO -->
<template>
    <div>
        <!-- header -->
        <el-card class="!border-none" shadow="never">
            <el-form ref="formRef" class="mb-[-16px] mt-[15px]" :inline="true" :model="queryParams">
                <el-form-item label="用户ID搜索">
                    <el-input
                        class="w-[160px] h-[32px]"
                        placeholder="请输入用户ID"
                        v-model="queryParams.uuid"
                        clearable
                    />
                </el-form-item>
				<el-form-item label="用户搜索">
				    <el-input
				        class="w-[160px] h-[32px]"
				        placeholder="请输入手机号/昵称"
				        v-model="queryParams.user_keyword"
				        clearable
				    />
				</el-form-item>
				<el-form-item label="支付单号搜索">
				    <el-input
				        class="w-[180px] h-[32px]"
				        placeholder="请输入支付单号"
				        v-model="queryParams.payment_trade"
				        clearable
				    />
				</el-form-item>
				<el-form-item label="订单号搜索">
				    <el-input
				        class="w-[180px] h-[32px]"
				        placeholder="请输入订单号"
				        v-model="queryParams.order_no"
				        clearable
				    />
				</el-form-item>
               <!-- <el-form-item label="到账状态">
                    <el-select
                        placeholder="全部"
                        class="w-[160px] h-[32px]"
                        v-model="queryParams.status"
                    >
                        <el-option label="全部" value="" />
                        <el-option label="已到账" :value="1" />
                        <el-option label="已退款" :value="0" />
                    </el-select>
                </el-form-item> -->
                <el-form-item label="充值时间">
                    <daterange-picker
                        v-model:startTime="queryParams.start_time"
                        v-model:endTime="queryParams.end_time"
                    >
                    </daterange-picker>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="resetPage">查询</el-button>
                    <el-button @click="resetParams">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none mt-4" shadow="never">
            <el-table size="large" class="mt-[14px]" :data="pager.lists">
                <el-table-column label="用户ID / 手机号 / 昵称" min-width="120">
                    <template #default="{ row }">
                        {{ row.uuid }} / {{ row.phone }} / {{ row.nickname }}
					</template>
                </el-table-column>
                <el-table-column label="订单号">
                    <template #default="{ row }">
                        <span>{{ row.order_no }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="支付单号">
                    <template #default="{ row }">
                       {{ row.payment_trade }}
                    </template>
                </el-table-column>
                <el-table-column label="充值金额">
                    <template #default="{ row }">
                        <span> {{ row.price}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="支付时间" prop="payment_time" />
                
            </el-table>
            <!-- 分页 -->
            <div class="flex justify-end mt-4">
                <pagination v-model="pager" @change="getLists" />
            </div>
        </el-card>
    </div>
</template>

<script lang="ts" setup>
import { usePaging } from '@/hooks/usePaging'
import { rechargeList, Delteamhead } from '@/api/teamhead'
import { getRoutePath } from '@/router'
import feedback from '@/utils/feedback'

const queryParams = reactive({
    uuid: '',
    user_keyword: '',
    order_no: '',
    end_time: '',
	payment_trade:'',
	start_time:''
})
const { pager, getLists, resetPage, resetParams } = usePaging({
    fetchFun: rechargeList,
    params: queryParams
})
getLists()
const handledel = async (id: number) => {
    try {
        await feedback.confirm('确定要删除？')
        await Delteamhead({ id })
        feedback.msgSuccess('操作成功')
        getLists()
    } catch (error) {
        console.log(error)
    }
}
</script>
<style lang="scss" scope>
//TODO
.el-alert--warning.is-light {
    background-color: rgba(246, 248, 255, 1);
    color: rgba(64, 115, 250, 1);
}
.text-red {
    color: red;
}
</style>
